﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;

namespace XLT_MobileTest
{
    public class VocabList
    {
        private Form1 __root;

        private bool _selected;

        private int _id;
        private int _language_id;
        private int _language_origin_id;
        private int _cnt_words;

        private float _percent;

        private string _name;

        private Language _language;
        private Language _language_origin;

        private List<Vocab> _words;


        public VocabList(Form1 root, int id, int language, int language_origin, int cnt_words, float percent, string name)
        {
            __root = root;

            _id = id;
            _language_id = language;
            _language_origin_id = language_origin;
            _language = new Language(root, _language_id);
            _language_origin = new Language(root, _language_origin_id);
            _cnt_words = cnt_words;
            _percent = percent;
            _name = name;

            _words = new List<Vocab>();
        }

        public void AddWord(Vocab word)
        {
            _words.Add(word);
        }

        public VocabList(Form1 root, int id)
        {
            __root = root;
            _id = id;
            // TODO: get all via net
        }

        public int GetWords()
        {
            _words = new List<Vocab>();
            return _words.Count;
        }

        public string NameShort 
        { 
            get 
            {
                if (_name.Length > 12)
                    return _name.Substring(0, 12);
                else
                    return _name;
            } 
        }


        public bool Selected { get { return _selected; } set { _selected = value; __root.RefreshWordList(); } }
        public int Id { get { return _id; } set { _id = value; } }
        public Language Language { get { return _language; } set { _language = value; } }
        public Language LanguageOrigin { get { return _language_origin; } set { _language_origin = value; } }
        public int CountWords { get { return _cnt_words; } set { _cnt_words = value; } }
        public float Percent { get { return _percent; } set { _percent = value; } }
        public string Name { get { return _name; } set { _name = value; } }
        public List<Vocab> Words { get { return _words; } set { _words = value; } }
    }
}
